Basic C Language MCQs

  1. Which of the following is a correct comment in C?
  1. Which data type is used to create a variable that should store text?
  1. Which of the following is the correct syntax to declare a variable in C?
  1. Which of the following is used to print a message on the screen in C?
  1. Which of the following is the correct way to read a string input from the user in C?
  1. Which function is used to find the length of a string in C?
  1. What is the index of the first element in an array in C?
  1. Which of the following is a loop construct in C?
  1. How do you declare a constant in C?
  1. Which of the following is a relational operator in C?
  1. What is the correct syntax for a for loop in C?
  1. What is the output of the following code? printf("%d ", 10 >9);
  1. Which keyword is used to return a value from a function?
  1. What is the size of an int data type in C (in bytes)?
  1. Which of the following is a correct way to declare a pointer in C?
  1. Which operator is used to access the value at the address stored in a pointer variable?
  1. Which function is used to allocate memory dynamically in C?
  1. What will be the output of the following code? printf("%d ", 5/2);
  1. Which of the following is the correct syntax to declare a structure in C?
  1. Which of the following is a valid array declaration in C?
  1. Which of the following function is used to open a file in C?
  1. What is the correct way to check for the end of a file in C?
  1. What will be the output of the following code? int x = 5; printf("%d ", x++);
  1. Which function is used to compare two strings in C?
  1. Which of the following is not a storage class in C?
  1. Which of the following is used to define a macro in C?
  1. What will be the output of the following code? printf("%c ", 'A '+ 1);
  1. Which of the following is a valid declaration of a function in C?
  1. What does the continue  statement do in a loop?
  1. Which of the following is a valid syntax for an if statement in C?
  1. What will be the output of the following code? printf("%d ", 10 % 3);
  1. Which of the following is used to terminate a statement in C?
  1. Which of the following is the correct way to initialize an array in C?
  1. Which of the following is not a bitwise operator in C?
  1. Which of the following is used to declare an array of pointers in C?
  1. What is the output of the following code? printf("%d ", 5 &3);
  1. Which header file is required for using the malloc  function?
  1. What is the return type of the malloc  function?
  1. What is the purpose of the free  function in C?
  1. Which of the following functions is used to write a character to the standard output in C?
  1. Which of the following function signatures is correct for main in C?
  1. Which of the following is the correct way to define a symbolic constant in C?
  1. Which of the following is a correct way to declare a multi-dimensional array in C?
  1. Which of the following functions is used to copy a string in C?
  1. What is the output of the following code? printf("%d ", sizeof(int));
  1. Which of the following is not a valid variable name in C?
  1. What will be the output of the following code? printf("%d ", 1 <<2);
  1. Which of the following is a preprocessor directive in C?
  1. Which of the following is used to skip to the next line in a file in C?
  1. What is the output of the following code? printf("%d ", 2 == 2.0);